package com.beijing.http.demo01;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Author Ma Wenqi
 * @Date 2021/3/28 10:02
 * @Version 1.0
 */
public class TestInetAdress {
    public static void main(String[] args) {
        try {
            InetAddress inetAdress1 = InetAddress.getByName("127.0.0.1");
            System.out.println(inetAdress1);

            InetAddress inetAdress2 = InetAddress.getByName("www.baidu.com");
            System.out.println(inetAdress2);

            InetAddress inetAdress3 = InetAddress.getByName("localhost");
            System.out.println(inetAdress3);

            InetAddress inetAdress4 = InetAddress.getLocalHost();
            System.out.println(inetAdress4);

        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
